<?php

namespace ApplicationTest;

use Application\Model\Dao\UpdateDao;
use Application\Model\Dao\UserDao;
use Application\Service\XmlService;
use Zend\Config\Reader\Xml;
use Zend\Json\Json;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;

class UpdateDaoTest extends AbstractHttpControllerTestCase
{

    public function setUp()
    {
        $this->setApplicationConfig(
            include '/Users/pankajmishra/source/myproj/bhaibandhu/config/application.config.php'
        );
        parent::setUp();
    }

   /* public function testUserAdd(){

        $userDao = new UserDao();
        $userDao->saveUser('pankaj', 'mishraawake@gmail.com',md5('abc123'));


    }

    public function testUserUpdate(){

        $userDao = new UserDao();
        $userDao->saveAdditionalUser(1,1,2,'1007','9711391354');

    }

   public function testUpdateAdd(){

        $updateDao = new UpdateDao();
        $updateDao->saveUpdateData('test',1,null,null,1,'group','{options:[{title: "Yes"},{title:"no"}]}',1);
    }


     public function testUpdateSave(){

        $updateDao = new UpdateDao();
        $updateDao->savePollData('{"options": [{"title": "Yes", "resp_count" : 0},{"title": "no",  "resp_count" : 0}]}',1);
    }

    public function testGetUpdateData(){

        $updateDao = new UpdateDao();
        $update = $updateDao->getUpdateData(0,1,array(1),100,true) ;

        var_dump($update[0]['poll_data']['options'][1]);
    }
*/

/*
    public function testSavePollResponse(){

        $updateDao = new UpdateDao();
        $update = $updateDao->savePollResponse(1,1,'testing',1);

    }
*/
    public function testGetUpdateData(){

        $updateDao = new UpdateDao();
        $update = $updateDao->getUpdateData(0,1,array(1),100,true) ;

        var_dump($update);
    }




    public function testXmlService(){

      /*  $discussion = array();
        $discussion[XmlService::$NUM_FIELD_NAME] = 'file';
        array_push($discussion, array('title' => 'dicussion', 'name' => 'x'));
        array_push($discussion, array('title' => 'dicussion1', 'name' => 'Y'));
       // $discussion['file'] = $discussionElem;
        $xmlw = new XmlService();
        $xml =  $xmlw-> customXml($discussion, 'dis');
        echo $xml;

        $reader = new Xml();
        $data  = $reader->fromString($xml);
        var_dump($data); */
    }
}

